﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using ElGee.Google.Charts;

namespace WebApp
{
    public static class GaugeData
    {
        /// <summary>
        /// Gets the data source for a Gauge.
        /// </summary>
        /// <returns></returns>
        public static ChartDataSource GetDataSource()
        {
            var ds = new ChartDataSource();

            // Horizontal Axis
            ChartDataTable dt = new ChartDataTable(TypeOfAxis.Horizontal, TypeOfColumn.String, "Labels");
            dt.Data.Add("Quality");
            dt.Data.Add("Reliability");
            dt.Data.Add("Success");
            ds.Tables.Add(dt);

            dt = new ChartDataTable(TypeOfAxis.Vertical, TypeOfColumn.Number, "Values");
            dt.Data.Add("89");
            dt.Data.Add("74");
            dt.Data.Add("81");
            ds.Tables.Add(dt);

            return ds;
        }

        public static Gauge GetOptions()
        {
            var chart = new Gauge();
            chart.Style.GreenFrom = 85;
            chart.Style.GreenTo = 100;
            chart.Style.YellowFrom = 55;
            chart.Style.YellowTo = 84;
            chart.Style.RedFrom = 0;
            chart.Style.RedTo = 54;
            chart.Style.Width = 500;
            chart.Style.Height = 300;
            return chart;
        }
    }
}